import cv2
video=cv2.VideoCapture("landscape.avi")
fps=video.get(cv2.CAP_PROP_FPS)
size=(int(video.get(cv2.CAP_PROP_FRAME_WIDTH)),int(video.get(cv2.CAP_PROP_FRAME_HEIGHT)))#设置帧的大小
fource=cv2.VideoWriter_fourcc(*'XVID')
output=cv2.VideoWriter("out.avi",fource,fps,size)
while(video.isOpened()):
	retval,frame=video.read()
	if retval:
		output.write(frame)
	else:
		break
print("视频已保存")
video.release()
output.release()
cv2.destroyAllWindows()
